<?php
// 下线专题
namespace Beerus\Modules\DesignerFinder\Actions;

use Doraemon\model\DesignerFinder\Subject;
use Illuminate\Http\Request;
use Encore\Admin\Actions\RowAction;

class Offline extends RowAction {
    public $name = '下线';

    public function handle($iSubjectId) {
        if (!Subject::offlineSubject($iSubjectId)) {
            return $this->response()->error('下线失败')->refresh();
        }
        return $this->response()->success('下线成功')->refresh();
    }

    public function retrieveModel(Request $request) {
        if (!$key = $request->get('_key')) {
            return false;
        }
        return $key;
    }

    public function dialog() {
        $this->confirm('确定下线该专题？');
    }
}
